# #!/usr/bin/python
# # -*- coding: utf-8 -*-
# import sys
# sys.path.append("../")
# sys.path.append("../../")
# sys.path.append("../../../")
# try:
#     from rpc.utils.filters import *
# except:
#     from utils.filters import *
# from flask import Flask, jsonify, request, json, make_response
# from sqlalchemy import create_engine, event, select, exc
# from sqlalchemy.orm import sessionmaker, scoped_session
#
# app = Flask(__name__)
# from tianyancha import *
#
# engine = create_engine('mysql+pymysql://supervisory:lx@v5.com@123.206.210.251:3307/supervisory_spider?charset=utf8',
#                        encoding='utf-8', echo=True, pool_recycle=1200, pool_size=100)
# db_session = scoped_session(sessionmaker(autocommit=False, autoflush=False, bind=engine))
#
#
#
# @app.teardown_request
# def shutdown_session(exception=None):
#     db_session.remove()
#
# @event.listens_for(engine, "engine_connect")
# def ping_connection(connection, branch):
#   if branch:
#     return
#   try:
#     connection.scalar(select([1]))
#   except exc.DBAPIError as err:
#     if err.connection_invalidated:
#       connection.scalar(select([1]))
#     else:
#       raise
#
#
# @app.route('/')
# def sss():
#     print("1")
#     return '200'
#
#
#
# @app.route('/tianyancha',methods=['POST'])
# def tianyancha():
#     print(request.form)
#     return 200
#
#
# @app.route('/11dai',methods=['POST'])
# def a11dai():
#     data = request.get_json()
#     data = json.loads(data)['data']
#     for i in data:
#         db_session().merge(clean_mark(i))
#     db_session().commit()
#
#     return make_response('ok')
#
#
#
#
# if __name__ == '__main__':
#     try:
#         app.run(threaded=True,debug=True,port=5001)
#     except Exception as e:
#         print(e)
